import request from '@/utils/request'
// 提交预约订单
export const submitOrder = (order) => {
  return request.post('/user/orders/booking', {
    ...order
  })
}
// 查询订单
export const searchOrder = (orderId) => {
  return request.get(`/user/orders/${orderId}`)
}

export const orderList = () => {
  return request.get('/user/orders/list')
}

export const deleteOrder = (orderId) => {
  return request.delete('/user/orders/delete/', {
    params: {
      orderId
    }
  })
}

export const updateUserStateOrder = (orderId, state) => {
  return request.patch(`/guests/manage/updateUserState/${orderId}/${state}`)
}

// 取消预约订单
export const cancelOrder = (orderId) => {
  return request.put(`/user/orders/cancel/${orderId}`)
}
// 支付预约订单
export function payBookingOrder (orderId, payPwd, payMethod) {
  return request.post(`/user/orders/pay?orderId=${orderId}&payPwd=${payPwd}&payMethod=${payMethod}`)
}
